iT邦幫忙

2023 iThome 鐵人賽

DAY 12
0
Mobile Development

App從開發到上架系列 第 12

Day13: iOS 開發:畫面功能(會員) - 基本註冊

  • 分享至 

  • xImage
  •  

今天是實作Firebase的功能:程式碼如下

import UIKit
import FirebaseAuth
import Firebase
class MemberShipViewController: BaseViewController {

    @IBOutlet weak var btnLogin: CustomButton!
    @IBOutlet weak var txfAccount: UITextField!
    @IBOutlet weak var txfPassword: UITextField!
    override func viewDidLoad() {
        super.viewDidLoad()
        print("you enter MemberShipViewController!")
        txfAccount.attributedPlaceholder = NSAttributedString(string: "Please Enter your Account....",attributes: [NSAttributedString.Key.foregroundColor: UIColor.orange])
        
        txfPassword.attributedPlaceholder = NSAttributedString(string: "Please Enter your Password....",attributes: [NSAttributedString.Key.foregroundColor: UIColor.orange])
        txfPassword.isSecureTextEntry = true
    }


    @IBAction func btnLoginTapped(_ sender: Any) {
        Auth.auth().createUser(withEmail: txfAccount.text!, password: txfPassword.text!) { result, error in
             guard let user = result?.user,
                   error == nil else {
                 print(error?.localizedDescription as Any)
                 return
             }
            print(user.email as Any, user.uid)
        }
    }
}

上一篇
Day11: iOS 開發:畫面建構(會員) - MemberShipViewController
下一篇
Day14: iOS 開發:畫面功能(會員) - 透過第三方來登入
系列文
App從開發到上架30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言